home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / spia.arc / MANUAL.DOC < prev    next >
Encoding:
Text File  |  1987-05-01  |  24.2 KB  |  645 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.            ________________________________________________
  15.            |                     SPIA                     |
  16.            |           An Interactive Guide To            |
  17.            |              Signal Processing               |
  18.            |                                              |
  19.            |                 USER'S GUIDE                 |
  20.            |                                              |
  21.            |             Moonshadow Software              |
  22.            |            5016 Castlewood Drive             |
  23.            |              San Jose, CA 95129              |
  24.            |                (408)-446-2459                |
  25.            |                                              |
  26.            |      (C) Moonshadow Software 1986,1987       |
  27.            ------------------------------------------------
  28.  
  29.  
  30.  
  31.  
  32.  
  33.                          License Information
  34.  
  35.     Non-registered users are granted a limited license to use SPIA on a
  36.     trial basis for the purpose of determining whether SPIA is suitable
  37.     for their needs.  Use of SPIA, except for this limited purpose,
  38.     requires registration.  Use of non-registered copies of SPIA by any
  39.     person, business, corporation, government agency or other entity
  40.     is strictly forbidden.
  41.  
  42.     Registration permits a user the license to use SPIA on a single
  43.     machine.
  44.  
  45.     All users are granted a limited license to copy SPIA only for the
  46.     trial use of others subject to the above limitations, and also the
  47.     following:
  48.  
  49.         * SPIA must be copied in unmodified form, complete with the
  50.           full documentation (including this license information).
  51.  
  52.         * No fee, charge or other compensation may be accepted or requested
  53.           by any licensee.
  54.  
  55.         * SPIA may not be distributed in conjunction with any other
  56.           product.
  57.  
  58.     Operators of electronic bulletin board systems may post SPIA for
  59.     downloading by their users only as long as the above conditions are met.
  60.  
  61.  
  62.  
  63.  
  64.  
  65.                                     WARRANTY
  66.  
  67.  
  68.     Moonshadow Software makes no representations or warranties with
  69.     respect to the contents hereof and specifically disclaims any    
  70.     implied warranties of merchantability or fitness for any       
  71.     particular purpose.  Further, Moonshadow Software reserves the right
  72.     to revise this publication and software and to make changes from
  73.     time to time in the content hereof without obligation of    
  74.     Moonshadow Software to notify any person of such revision or    
  75.     changes.
  76.  
  77.     SPIA is a trademark of Moonshadow Software.
  78.  
  79.  
  80.  
  81.  
  82.  
  83.                               ORDERING INFORMATION
  84.  
  85.  
  86.     A SPIA registration licenses you to the use of the product on a
  87.     regular basis.  Registration includes mailed notification of
  88.     updates and update privileges for a nominal fee.  To register
  89.     send
  90.                                                                            
  91.      * $79.95 which includes the typeset manual, telephone support, the   
  92.        latest version on disk, and update privileges.
  93.                                                                            
  94.     Please add $5 shipping, $10 outside U.S. CA residents add sales tax.
  95.  
  96.     In addition, evaluation disks are available for $10.  These disks 
  97.     do not include registration.
  98.  
  99.     Please use the enclosed order form when placing an order.
  100.  
  101.     ORDERS OUTSIDE THE US: Please send checks drawn on US banks in US 
  102.     dollars.  In addition, make sure $10 shipping is included for any 
  103.     items ordered.
  104.  
  105.  
  106.  
  107.  
  108.  
  109.                               ORDER FORM
  110.  
  111.     Send to:      Moonshadow Software
  112.                   5016 Castlewood Drive
  113.                   San Jose, CA 95129
  114.                   (408)-446-2459
  115.              
  116.  
  117.     Please send me the latest releases of:
  118.  
  119.  
  120.     ____ SPIA Evaluation Disk....................... @ $ 10.00 ea  $ ______
  121.             (includes program and manual on disk, no registration)
  122.  
  123.  
  124.     ____ SPIA Registration Package.................. @ $ 79.95 ea  $ ______
  125.             (includes registration, program, typeset manual,
  126.              telephone support, update privileges)
  127.  
  128.                                                          Subtotal    ______
  129.  
  130.                               (CA residents add sales tax)    Tax    ______
  131.  
  132.                                                              Total $ ______
  133.  
  134.  
  135.        Name: ____________________________________________________________
  136.  
  137.     Company: ____________________________________________________________
  138.  
  139.     Address: ____________________________________________________________
  140.  
  141.              ____________________________________________________________
  142.  
  143.              ____________________________________________________________
  144.  
  145.       Phone: _________________________ 
  146.  
  147.  
  148.    Comments: ____________________________________________________________
  149.  
  150.              ____________________________________________________________
  151.  
  152.              ____________________________________________________________
  153.  
  154. Where you heard about/
  155. received your copy: _____________________________________________________
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.                              INTRODUCTION
  163.  
  164.    SPIA is a mathematical scratchpad for functions.  SPIA provides an
  165.    interactive environment in which to study functions (like sin, cos,
  166.    etc.) and signal processing techniques (like Fourier transform,
  167.    convolution, etc.).  SPIA is easy to use (really!), and serves a
  168.    variety of needs.  From the high school student learning for the
  169.    first time about graphing functions and trigonometry to the
  170.    practicing engineer interested in the power spectrum of a function.
  171.  
  172.    SPIA is actually an interpretive language where instead of the scalar
  173.    variables found in BASIC and FORTRAN one has "function" variables. As
  174.    a result, one enters algebraic statements very similar to what would
  175.    be used to manipulate equivalent functions on paper.   
  176.  
  177.    The user is able to construct functions from that of a predefined set
  178.    and manipulate them and examine the result graphically.  SPIA uses
  179.    algebraic logic.
  180.  
  181.    The following pages are an abbreviated form of the typeset manual
  182.    available upon registration.  SPIA is designed to be intuitive in
  183.    nature, and we invite you to "jump in".  SPIA works the way you might
  184.    with paper and pencil.  
  185.  
  186.    SPIA is a electronic scratchpad for mathematical functions and
  187.    operations.
  188.  
  189.  
  190.  
  191.  
  192.  
  193.                              INSTALLATION
  194.  
  195. REQUIREMENTS
  196.  
  197.    SPIA requires an IBM PC/XT/AT/System/2 or compatible and a graphics
  198.    adapter. SPIA also requires 256 K bytes of RAM.  The graphics
  199.    standards supported are:
  200.  
  201.                * Hercules monochrome
  202.                * IBM Color Graphics Adapter (CGA)
  203.                * IBM Enhanced Graphics Adapter (EGA)
  204.                * IBM Video Graphics Array Adapter (VGA)
  205.  
  206.    Although SPIA does not require a math coprocessor (8087/80287/80387),
  207.    if your machine has one it will use it. Because SPIA is very math
  208.    intensive, a math coprocessor will improve its performance
  209.    significantly. On an IBM PC/XT with no math coprocessor the time for
  210.    a Fourier transform is about 20 sec.
  211.  
  212.    SPIA can be run from a floppy or hard disk.  
  213.  
  214.  
  215. BACKUP COPIES
  216.  
  217.    Before configuring or installing SPIA on your computer, make a copy
  218.    of the SPIA SHAREWARE distribution disk.  We encourage you to make
  219.    copies of this diskette to share with your colleagues.
  220.  
  221.    Once SPIA is configured for your computer the SPIA disk is customized
  222.    and cannot be used on another computer without running the included
  223.    RECONFG program.  So to prevent confusion, please distribute the
  224.    unconfigured original SPIA SHAREWARE distribution diskette.
  225.  
  226.  
  227. CONFIGURATION and INSTALLATION
  228.  
  229.    To configure and install SPIA on your computer simply insert the SPIA
  230.    SHAREWARE distribution disk in drive A and type "CONFIG" (without the
  231.    quotes).  For example:
  232.  
  233.                         A>CONFIG [Enter]
  234.  
  235.    The floppy disk is customized for your computer and if requested a
  236.    customized copy is also transferred to the hard drive in C:\SPIA.
  237.  
  238. RUNNING SPIA
  239.  
  240.    Once SPIA has been configured it is run by typing RUNSPIA.  For a
  241.    floppy based system simply insert the configured diskette in drive A
  242.    (or B) and type "A:[Enter]" and then "RUNSPIA".
  243.  
  244.    On a hard drive one needs to first change to the SPIA subdirectory
  245.    and then type RUNSPIA.  For example:
  246.  
  247.                         C>CD \SPIA [Enter]
  248.                         C>RUNSPIA [Enter]
  249.  
  250.  
  251.  
  252.  
  253.  
  254.                               USING SPIA
  255.  
  256.    SPIA is essentially an interpretive programming language, in which
  257.    the variables are functions (vectors) and the operators are the basic
  258.    mathematical operations with a few special ones thrown in.  By taking
  259.    the supplied functions and operators (and a little ingenuity) one can
  260.    custom build an enormous array of functions upon which to experiment.
  261.    The commands which invoke these functions and operations are entered
  262.    in the command window at the bottom of the screen.  The commands are
  263.    pretty much what one might write on paper to algebraically set up the
  264.    mathematical operation.  The commands and functions are detailed in
  265.    the command summary section.
  266.  
  267.    SPIA's working screen is divided into 3 functional windows: The
  268.    display window, the message window, and the command line window.
  269.  
  270.            ________________________________________________
  271.            |                                              |
  272.            |                                              |
  273.            |                                              |
  274.            |                 DISPLAY WINDOW               |
  275.            |                                              |
  276.            |                                              |
  277.            |                                              |
  278.            ------------------------------------------------
  279.            |                 MESSAGE WINDOW               |
  280.            ------------------------------------------------
  281.            |                 COMMAND WINDOW               |
  282.            ------------------------------------------------
  283.  
  284.  
  285.  
  286.    THE DISPLAY WINDOW.  It is here that help screens are displayed and
  287.    the graphics representation of the functions are displayed.  When
  288.    displaying functions, there are 3 work areas used: A, B, and C.  This
  289.    allows the viewing of 3 functions at a time.  Each function has as
  290.    its range -2 to +2, with 0 marked on the x axis.  The ordinate range
  291.    is marked on the y axis each time a function is displayed.
  292.  
  293.    Unless specified all functions and their resulting manipulations are
  294.    placed in the A work area for display.  In a programming sense it is
  295.    assigned to A.  For example:
  296.  
  297.                         SINX + COSX
  298.  
  299.    gets the predefined functions sin(x) and cos(x), adds them together
  300.    and places the result in the A work area.  This is equivalent to
  301.    saying
  302.  
  303.                         A = SINX + COSX
  304.  
  305.  
  306.  
  307.  
  308.  
  309.                        USING SPIA - continued-
  310.  
  311.    Once a work area has been assigned a result, it can be used in
  312.    subsequent expressions, for example
  313.  
  314.                         ABS(A)
  315.  
  316.    takes the absolute value of A, which currently has the result of
  317.    SINX+COSX.  Notice too, that this expression places the results of
  318.    ABS(A) in A! (since there is no explicit assignment)  So, one can
  319.    recursively assign work areas, much like that of variables in BASIC
  320.    and FORTRAN.  To place the results in the other work areas simply
  321.    make the assignments, like so
  322.  
  323.                         A = SINX
  324.                         B = SINX + COSX
  325.                         C = ABS(B)
  326.  
  327.    The above command sequence would allow us to see the progression of
  328.    our operations graphically, instead of writing over our intermediate
  329.    steps.
  330.  
  331.    One other aspect of the display work areas bears mentioning - the
  332.    display of imaginary functions.  Since SPIA can operate with complex
  333.    functions (ie. functions with both real and imaginary parts) the
  334.    display area is structured so that one can display either the real or
  335.    imaginary parts independently.  This is accomplished by typing either
  336.    IA, IB, and IC in the command window to view the imaginary parts of
  337.    the complex functions A, B or C.
  338.  
  339.    IA, IB and IC are also used to view the phase parts of A, B and C if
  340.    the functions have been converted to their amplitude/phase form by
  341.    the AMP() function.
  342.  
  343.    More about complex functions later.
  344.  
  345.  
  346.    THE MESSAGE WINDOW.  As its name implies, this window provides you
  347.    with messages pertaining to the program's operation.  There are 4
  348.    types of messages:
  349.  
  350.                         Error messages
  351.                         Informational messages
  352.                         Prompts
  353.                         Mode messages
  354.  
  355.    THE COMMAND LINE WINDOW.  This is a three line scrolling window which
  356.    displays your commands.
  357.  
  358.  
  359.  
  360.  
  361.  
  362.                             GENERAL NOTES
  363.  
  364.    SPIA has a dictionary of functions (nouns) and operators (verbs). 
  365.    With these it is possible to construct new functions upon which
  366.    further operations can be carried out.  The command lines are entered
  367.    and parsed one line at a time based on a set of precedence rules.
  368.    The available functions, operators, and commands are described in
  369.    detail on the following pages and a quick summary can be invoked
  370.    during program operation by typing HELP.  SPIA is meant to be
  371.    exploratory in nature, so don't hesitate just trying things out.
  372.  
  373.    The functions in SPIA are defined over the range of x = -2 to x = +2,
  374.    eg. SINX, the sin(pi*x), ranges over -2pi to +2pi.  Each function
  375.    contains 256 points.
  376.  
  377.  
  378. PARSING 
  379.  
  380.    The parser in SPIA will parse (that is grammatically resolve the
  381.    command line into a collection of functions and operations on those
  382.    functions) most reasonable algebraic command lines.  If there is any
  383.    doubt as to the order of operations, the liberal use of parentheses 
  384.    will force the order to your liking, eg:
  385.  
  386.                          B = A + B * C      will be done as A + (B*C)
  387.  
  388.                          B = (A + B) * C    will be done as (A+B) * C
  389.  
  390.    The precedence of operators is:
  391.  
  392.                          'unary' > 'binary' = '*' = '/' > '+' = '-'
  393.  
  394.    where unary refers to operators with only one argument, like FT(A), 
  395.    IFT(A), SQRT(A), ABS(A), and binary refers to operators like CONV and
  396.    CORR that require two (A CONV B).  When operator precedence is equal,
  397.    the left most operator has precedence.
  398.  
  399.    If you are unsure of how the computer interpreted your command -
  400.    watch the message window.  This will reflect the order of operation. 
  401.    For example A+B*C will flash in succession "evaluating product",
  402.    "evaluating sum".
  403.  
  404.    Like english (or at least like most programming languages) SPIA has a
  405.    grammar, and while it is reasonably easy to trip it up, it is also
  406.    reasonably easy to deliver commands that do what you had wanted! 
  407.    Somewhere in between an adventure game and a calculator.
  408.  
  409.    Currently, the unary minus is not supported.  It is easy to work
  410.    around.  For example:
  411.  
  412.                          (0 - 1) * GAUSS
  413.  
  414.  
  415.  
  416.  
  417.  
  418.                      GENERAL NOTES - continued -
  419.  
  420. COMPLEX ARITHMETIC
  421.  
  422.    Because Fourier Transforms generate complex functions, there is the
  423.    ability to manipulate and display these complex functions in SPIA. 
  424.    There are two modes within SPIA: COMPLEX ON and COMPLEX OFF.  These
  425.    two commands can be typed to force the mode of arithmetic
  426.    calculation.  Basically if complex arithmetic is on, then addition,
  427.    subtraction, multiplication and division take into account the
  428.    imaginary parts of the functions.  Complex arithmetic is
  429.    automatically turned on when taking the FT of some function, and it
  430.    is automatically turned off when the inverse FT is taken.  Again,
  431.    these modes can be manually invoked.
  432.  
  433.    It is important when doing arithmetic in the frequency domain that
  434.    the complex mode be on, otherwise the imaginary component of the
  435.    result of the operation always has a zero component.
  436.  
  437.  
  438.  
  439.  
  440.  
  441.                            COMMAND SUMMARY
  442.  
  443. MATHEMATICAL OPERATIONS
  444. -----------------------
  445. ABS(A)......the absolute value of the function in A.
  446. AMP(A)......converts real/imaginary to amplitude phase of A.
  447. CONJ(A).....the complex conjugate of A.
  448. A CONV B....performs the convolution integral of A with B.
  449. A CORR B....performs the cross correlation integral of A with B,
  450. DERIV(A)....the difference between the ith and (i+1)th points
  451.             for all points, with the final point being equal to
  452.             the differential before it.  Hence, errors can 
  453.             accumulate in the last point.
  454. EXP(A)......the exponential of each point in A.
  455. FORCE(A)....forces the endpoints of A = 0, thereby eliminating end
  456.             effects in the Fourier transform.
  457. FT(A).......the Fourier Transform of A.  The imaginary part can
  458.             be displayed by IA.  Complex arithmetic mode
  459.             automatically turned on.
  460. IFT(A)......the inverse Fourier Transform of A.  Complex mode turned off.
  461. INTEG(A)....the integral of A.
  462. LOG(A)......the log base 10 log of each point in A.
  463. LN(A).......the log base e of each point in A.
  464. MIRROR(A)...the right side of a function mirrored into the eft.
  465. MSHIFT(A)...shifts the function A left (minus) by 10%.
  466. RE(A).......converts function from amplitude/phase space to
  467.             real/imaginary.
  468. SHIFT(A)....shifts the function A right (plus) by 10%.
  469. SMOOTH(A)...3 point smooth of A.
  470. SQRT(A).....the square root of each point in A.
  471. TEN(A)......the power of A to the base 10, for each point in A.
  472. A + B.......sums each point of A and B respectively.
  473. A - B.......subtracts each point of B from each point of A.
  474. A * B.......multiplies each point of A and B respectively.
  475. A / B.......divides each point of A by each point of B, respectively.
  476. A ** n......takes each point of A and raises it to the n-th power.  
  477.             Note, number can be any real number, but it cannot be 
  478.             another function.  Ie. SINX**COSX is not allowed.
  479. A = B.......takes each point in B and assigns it to A.
  480.  
  481.  
  482.  
  483.  
  484.  
  485.                     COMMAND SUMMARY - continued -
  486.  
  487. DEFINED FUNCTIONS
  488. -----------------
  489.        
  490. n...........any number can be input as a function, this has the
  491.             effect of assigning each point of that function to be
  492.             that number.  eg. B=17.5 assigns each point of B to
  493.             be 17.5, (SINX+1)/NOISE*10 adds 1 (one) to each point
  494.             of the function SINX, and divides it by the function
  495.             NOISE times 10.
  496. A,B,C.......these are user defined functions, having zero values
  497.             until assigned.  B and C must be explicitly assigned,
  498.             as in B=COSX, but A is implicitly assigned by typing
  499.             COSX.
  500. IA,IB,IC....these are the imaginary counterparts to A,B, and C. 
  501. COSX........cosine of pi*x where x:-2 to +2
  502. DEL0........delta function at x=0
  503. EXPMX.......the exponential of the absolute value of x:-2 to +2
  504.             exp(-abs(x)).
  505. GAUSS.......the gaussian. defined as exp(-pi*(x**2))
  506. HEAVY.......the Heavyside step function, defined as zero for x<0 
  507.             and 1 for x>0.
  508. III.........sampling function, delta functions at regular intervals.
  509. II..........pair of delta functions at x=1,-1.
  510. LOREN.......the lorentzian, mean of zero, halfwidth of 1.
  511. NOISE.......pseudo random noise of intensity -0.1 to +0.1
  512.             (approximately 10% of many of the above functions).
  513. NOTCH.......defined as 1 for abs(x) > 0.1, and 0 for abs(x) < 0.1,
  514.             excellent for applying filers to FT's.
  515. RECT........rectangle function, 0 for abs(x) > .5, 1 for abs(x) <= .5
  516. SIGN........defined as -1 for x<0 and +1 for x>=0.
  517. SINX........sin(pi*x) over -2pi to +2pi.  Also supported are SIN2X
  518.             thru SIN9X, where SIN9X is sin(9*pi*x)
  519. SINCX.......defined as sin(pi*x)/(pi*x), sinc(0) = 1.  Also SINC2X
  520.             thru SINC9X.
  521. TRI.........the triangle function, defined as 1-abs(x) for abs(x) < 1 
  522.             and 0 elsewhere.
  523. X...........ramp from -1 to +1.
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.                     COMMAND SUMMARY - continued -
  531.  
  532. COMMANDS
  533. --------
  534.  
  535. COMPLEX [ON/OFF]..used to control complex arithmetic mode, when
  536.                   complex mode is on the operations +,-,*, and / are
  537.                   done with both the imaginary and real parts of the
  538.                   functions.  Note the complex annunciator is turned on
  539.                   in complex mode.
  540. EXIT..............exit program.
  541. FAST [ON/OFF].....determines if convolution/correlation is done with
  542.                   integer arithmetic (fast) or floating point (slow). 
  543.                   Functions must be prepared before use by
  544.                   multiplying by the desired precision.  Eg:
  545.                   100*SINX allows fast convolution to within 3
  546.                   significant figures.
  547. FILE..............reads in user acquired data files. Text files
  548.                   (ASCII) can be read, where the numbers are one per
  549.                   line (with no commas etc.) and can be integer,
  550.                   floating point or exponential, eg:
  551.                               32
  552.                               .73
  553.                               8.1E-05
  554. HELP..............displays a quick summary of commands.
  555. PLOT..............plots screens.
  556. PRINT.............prints the screen.
  557. RESTORE...........restores previously saved functions.
  558. SAVE..............saves current set of functions.
  559. SUPPRESS [ON/OFF].suppresses digital error propagation.  Default is on.
  560. QUIT..............same as exit.
  561.  
  562.  
  563.  
  564.  
  565.  
  566.                                EXAMPLES
  567.  
  568. FOURIER FILTERING.  
  569.  
  570.    One of the novel techniques available in Fourier space is frequency
  571.    filtering.  In this case we will filter out the high frequency
  572.    component from our signal.  The theory being that the low frequency
  573.    information is what the signal of interest is comprised of and the
  574.    high frequency information is purely noise.  The truth of this
  575.    statement can vary drastically from situation to situation, lets look
  576.    at two of them.
  577.  
  578. CASE I
  579.  
  580. (1) Create a gaussian with noise, place it in C for reference
  581.  
  582.                          GAUSS + NOISE   (places the result in A)
  583.                          C = A
  584.  
  585. (2) Take the transform of the resultant function, lets also save it
  586.     for further manipulation
  587.  
  588.                          FT(A)
  589.                          B = A
  590.  
  591. (3) Apply a notch filter to the transform, create it first in A, then
  592.     multiply the transform, B, by it (this applies the filter) and
  593.     finally take the inverse transform.
  594.  
  595.                          1 - NOTCH   (like a very narrow square function)
  596.                          A * B       (note this is complex multiplication)
  597.                                      (A now holds the filtered transform)
  598.                          IFT(A)
  599.  
  600.    You'll find that the resultant function in A is a smoothed version of
  601.    GAUSS+NOISE in C.  What would have happened if the filter function to
  602.    be applied was RECT?  Also try adding 10*NOISE, instead of just NOISE, 
  603.    to GAUSS, to give a signal to noise ratio of 1:1 and repeat the
  604.    filter exercise.
  605.  
  606.  
  607.  
  608.  
  609.                         EXAMPLES - continued -
  610.  
  611. CASE II
  612.  
  613. (1) Let's apply this technique to another function.  Create a train of 
  614.     peaks like so:
  615.  
  616.                          SIN5X**10
  617.  
  618. (2) Reproducing the steps (1) to (3) in case I, only using this function 
  619.     as the base
  620.  
  621.                          A + NOISE
  622.                          C = A
  623.                          FT(A)
  624.                          B = A
  625.                          (1 - NOTCH)*B
  626.                          IFT(A)
  627.  
  628.     Apparently not an appropriate filter to apply in this case, due
  629.     to the higher frequency content of our desired signal!  Try it
  630.     with RECT as the filter function.
  631.  
  632.    Note the above examples could have been created with far fewer steps
  633.    by simply applying the operations successively:
  634.  
  635.                          IFT((1 - NOTCH)*B)
  636.  
  637.    This concludes the abbreviated on-disk SPIA manual.  
  638.  
  639.    Please pass this software on.  And if you find SPIA useful, please do
  640.    register it.  Remember, registration pays for the continuing
  641.    development of this software and software like this.
  642.  
  643.    Thank you for your support.
  644.  
  645.